/**
 * 
 */
package com.dj.common.web.exception;

/**
 * 
 * @author 何利荣
 *
 */
public abstract class DjException extends ControllerException {

	private static final long serialVersionUID = 1L;

	private static final Object[][] EMPTY_PARAMS = new Object[0][2];

	/**
	 * 错误代码
	 */
	private String errorCode;

	/**
	 * 错误消息参数,如throw new InvalidRequestException(ErrorCodes.nameExisted, new Object[][] { { "key", "value" } });
	 * params = {{"key","value"}}
	 */
	private Object[][] localizedErrorMessageParams = EMPTY_PARAMS;

	public DjException(String errorCode, Object[]... params) {
		this(null, errorCode, params);
	}
	public DjException(String errorMsg,int e) {
		super(errorMsg);
	}
	/**
	 * 
	 * @param errorCode
	 * @param throwable
	 * @param params
	 */
	public DjException(Throwable throwable, String errorCode, Object[]... params) {
		super(throwable);
		this.errorCode = errorCode;
		this.localizedErrorMessageParams = params == null ? EMPTY_PARAMS : params;
	}

	public String getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	public Object[][] getLocalizedErrorMessageParams() {
		return localizedErrorMessageParams;
	}
}